<template>
  <div class="home_warp">
    <!-- header -->
    <van-sticky>
      <Headers>
        <template #left>
          <van-icon name="arrow-left" />
        </template>
        <template #title>
          <h3>京东输入</h3>
        </template>
        <template #right>
          <van-icon name="coupon-o" />
        </template>
      </Headers>
    </van-sticky>

    <main>
      <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item>1</van-swipe-item>
        <van-swipe-item>2</van-swipe-item>
        <van-swipe-item>3</van-swipe-item>
        <van-swipe-item>4</van-swipe-item>
      </van-swipe>
      <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item>
          <van-grid :column-num="5">
            <van-grid-item
              v-for="value in 10"
              :key="value"
              icon="photo-o"
              text="文字"
            />
          </van-grid>
        </van-swipe-item>
        <van-swipe-item>
          <van-grid :column-num="5">
            <van-grid-item
              v-for="value in 10"
              :key="value"
              icon="photo-o"
              text="文字"
            />
          </van-grid>
        </van-swipe-item>
        <van-swipe-item>
          <van-grid :column-num="5">
            <van-grid-item
              v-for="value in 10"
              :key="value"
              icon="photo-o"
              text="文字"
            />
          </van-grid>
        </van-swipe-item>
        <van-swipe-item>
          <van-grid :column-num="5">
            <van-grid-item
              v-for="value in 10"
              :key="value"
              icon="photo-o"
              text="文字"
            />
          </van-grid>
        </van-swipe-item>
      </van-swipe>
      <div class="bod">
        <Item v-for="(item, index) in listArr" :key="index" :item="item">
        </Item>
      </div>
    </main>
  </div>
</template>

<script>
import Item from "../components/Item.vue";
import { Icon } from "vant";
import Vue from "vue";
import Headers from "../components/Header.vue";
import { Swipe, SwipeItem, Lazyload, Grid, GridItem, Sticky } from "vant";
import reqs from "../utils/axios";
import "@/Api/mockData";

Vue.use(Sticky);
Vue.use(Grid);
Vue.use(GridItem);
Vue.use(Lazyload);
Vue.use(Swipe);
Vue.use(SwipeItem);
Vue.use(Icon);

export default {
  components: {
    Headers,
    Item,
  },
  data() {
    return {
      images: [],
      listArr: [],
    };
  },
  methods: {
    name() {},
  },
  created() {
    reqs.get("/api/data").then((res) => {
      console.log(res.data);
      this.listArr = res.data.datas;
    });
  },
};
</script>

<style lang='scss' scoped>
.home_warp {
  width: 100%;
  height: calc(100% - 50px);
}
main {
  width: 100%;
  height: calc(100% - 50px);
}
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.van-grid-item {
  color: red;
}
.bod {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: space-around;
}
</style>